package com.waverider.promotion.enums;

/**
 * 订单状态
 * @author sihai
 *
 */
public enum OrderStatusEnum
{
	/**
	 * <ul>
		<li>TRADE_NO_CREATE_PAY(没有创建支付宝交易) 
		<li>WAIT_BUYER_PAY(等待买家付款) 
		<li>WAIT_SELLER_SEND_GOODS(等待卖家发货,即:买家已付款) 
		<li>WAIT_BUYER_CONFIRM_GOODS(等待买家确认收货,即:卖家已发货) 
		<li>TRADE_BUYER_SIGNED(买家已签收,货到付款专用) 
		<li>TRADE_FINISHED(交易成功) 
		<li>TRADE_CLOSED(付款以后用户退款成功，交易自动关闭) 
		<li>TRADE_CLOSED_BY_TAOBAO(付款以前，卖家或买家主动关闭交易)
	  </ul>
	 */
	ORDER_STATUS_NO_CREATE_PAY(0, "没有创建支付宝交易", "TRADE_NO_CREATE_PAY"),								// 没有创建支付宝交易
	ORDER_STATUS_WAIT_BUYER_PAY(1, "等待买家付款", "WAIT_BUYER_PAY"),										// 等待买家付款
	ORDER_STATUS_WAIT_SELLER_SEND_GOODS(2, "等待卖家发货,即:买家已付款", "WAIT_SELLER_SEND_GOODS"),			// 等待卖家发货,即:买家已付款
	ORDER_STATUS_WAIT_BUYER_CONFIRM_GOODS(3, "等待买家确认收货,即:卖家已发货", "WAIT_BUYER_CONFIRM_GOODS"),	// 等待买家确认收货,即:卖家已发货
	ORDER_STATUS_BUYER_SIGNED(4, "买家已签收,货到付款专用", "TRADE_BUYER_SIGNED"),							// 买家已签收,货到付款专用
	ORDER_STATUS_FINISHED(5, "交易成功", "TRADE_FINISHED"),												// 交易成功
	ORDER_STATUS_CLOSED(6, "付款以后用户退款成功，交易自动关闭", "TRADE_CLOSED"),								// 付款以后用户退款成功，交易自动关闭
	ORDER_STATUS_CLOSED_BY_TAOBAO(7, "付款以前，卖家或买家主动关闭交易", "TRADE_CLOSED_BY_TAOBAO"),			// 付款以前，卖家或买家主动关闭交易
	ORDER_STATUS_REBATED(8, "已经返利", "ORDER_REBATED");
	
	private int value;
	private String desc;
	private String key;
	
	private OrderStatusEnum(int value, String desc, String key)
	{
		this.value = value;
		this.desc = desc;
		this.key = key;
	}
	
	public static OrderStatusEnum toEnum(int value)
	{
		for(OrderStatusEnum e : OrderStatusEnum.values())
		{
			if(e.value == value)
			{
				return e;
			}
		}
		
		return null;
	}
	
	public int value()
	{
		return value;
	}
	
	public String desc()
	{
		return desc;
	}
	
	public String key()
	{
		return key;
	}
}
